package com.cqc.pgy02;

import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.pgyersdk.feedback.PgyFeedback;
import com.pgyersdk.feedback.PgyFeedbackShakeManager;
import com.pgyersdk.update.PgyUpdateManager;

public class MainActivity extends BaseActivity implements View.OnClickListener {

    private FloatingActionButton fab;
    private Button btn1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViews();
        initViews();
    }

    private void initViews() {
        fab.setOnClickListener(this);
        btn1.setOnClickListener(this);
    }

    private void findViews() {
        fab = (FloatingActionButton) findViewById(R.id.fab);
        btn1 = (Button) findViewById(R.id.btn1);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.fab:
                //dialog
//                PgyFeedback.getInstance().showDialog(MainActivity.this, true);//back后报错
                PgyFeedback.getInstance().showDialog(MainActivity.this);
                //activity
//                PgyFeedback.getInstance().showActivity(MainActivity.this);
                break;
            case R.id.btn1:
                PgyUpdateManager.register(MainActivity.this);
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        PgyUpdateManager.unregister();
    }
}
